package constant

type MessageType int

const (
	MessagePing MessageType = iota
	MessageText
	MessageFile
	MessageHeart = "ping"
)

func (t MessageType) Val() uint8 {
	return uint8(t)
}

func GetMessageType(msgType uint8) MessageType {
	if MessagePing.Val() == msgType {
		return MessagePing
	}
	if MessageText.Val() == msgType {
		return MessageText
	}
	if MessageFile.Val() == msgType {
		return MessageFile
	}
	return 0
}
